Skip to content

[#350] Round token price and supply to readable precision#361

Merged
realproject7 merged 1 commit intomainfrom
task/350-number-formatting
Mar 19, 2026
Merged

[#350] Round token price and supply to readable precision#361
realproject7 merged 1 commit intomainfrom
task/350-number-formatting

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • Added shared formatPrice() and formatSupply() utilities in lib/format.ts
  • formatPrice: 0.017411...0.0174, 12.345...12.35, tiny values → exponential
  • formatSupply: 379827.26...379,827, millions → 1.2M
  • Applied to: story page header, reader portfolio, writer dashboard, OG metadata

Fixes #350

Files changed

  • lib/format.ts — new shared formatting utilities
  • src/app/story/[storylineId]/page.tsx — price + supply in header and OG metadata
  • src/components/ReaderPortfolio.tsx — total value, balances, holding values
  • src/components/WriterTradingStats.tsx — price + TVL

Test plan

  • next build passes
  • Verify story page shows 0.0174 PL_TEST instead of 0.017411310665880643 PL_TEST
  • Verify supply shows 379,827 tokens instead of 379827.262608456025243581 tokens
  • Verify reader portfolio and writer dashboard values are rounded

🤖 Generated with Claude Code

Add shared formatPrice/formatSupply utilities in lib/format.ts.
Apply formatting to: story page header (price + supply), reader
portfolio (total value, balances, holding values), writer dashboard
(price + TVL), and OG metadata description.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. formatPrice/formatSupply utilities are clean with good edge case handling (NaN, zero, tiny values, millions). Applied consistently across story page, reader portfolio, writer dashboard, and OG metadata. TVL correctly uses formatPrice since it's reserve-denominated. Approved.

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

The PR matches issue #350 and introduces shared formatting utilities that are applied across the story header, reader portfolio, and writer dashboard without widening scope unnecessarily. I also checked the existing home-card TVL path, which already uses its own compact formatting and does not create a gap in this change.

Findings

  • No correctness or design issues found in the submitted diff.

Decision

Approved on code review. lint-and-typecheck was still pending at the time of review, so merge should still wait for required GitHub checks.

@realproject7 realproject7 merged commit 9de03ca into main Mar 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UX] Round token price and supply display to readable precision

2 participants